package com.example.spring5.ms;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: Hu Rui
 * @Date: 2021/11/12 15:40
 */
public class Test {
    public int maxArea(int[] height) {
        if(height == null || height.length < 2){
            return 0;
        }
        int ans = 0;
        for(int l = 0,r = height.length;l != r;){
            int tmpAns = (Math.min(height[l],height[r])) * (r - l);
            ans = Math.max(tmpAns,ans);
            if(height[l] < height[r]){
                l++;
            }else{
                r--;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");
        list.add("e");
        List<String> sub = list.subList(1, 3);
        sub.set(0, "b1");
        System.out.println(list.get(1));

    }
}
